<?php
namespace slinks\core\dependencyInjectionExt;

use slinks\core\DependencyInjection\ContainerInterface;

use slinks\core\DependencyInjection\Reference as BaseReference;


/**
 * Extends reference for slinks functionality. 
 * 
 * @author Navid Mitchell
 *
 */
class Reference extends BaseReference {
	
	private $interface;
	
	private $qualifier;
	
	/**
     * Constructor.
     *
     * @param string  $id              The service identifier
     * @param Boolean $interface       If true then this reference id is the name of a services interface or class and not a service directly.
     * @param string  $qualifer        if interface is true then this qualifer can be used if more than 1 service implement the desired interface.
     *                                 If no qualifier is set and more than 1 service is found with the given interface autowiring will fail with an exception. 
     * @param int     $invalidBehavior The behavior when the service does not exist
     * @param Boolean $strict          Sets how this reference is validated
     *
     * @see Container
     */
    public function __construct($id, $interface=false, $qualifier=null, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $strict = true){
    	parent::__construct($id, $invalidBehavior,$strict);
    	$this->interface = $interface;
    	$this->qualifier = $qualifier;
    }
	

	public function isInterface()
	{
	    return $this->interface;
	}

	public function setInterface($interface)
	{
	    $this->interface = $interface;
	}

	public function getQualifier()
	{
	    return $this->qualifier;
	}

	public function setQualifier($qualifier)
	{
	    $this->qualifier = $qualifier;
	}
}



